package com.twu.biblioteca.model.session;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * User: cschlumb
 * Date: 09/08/2013
 * Time: 14:57
 * To change this template use File | Settings | File Templates.
 */
public class Session {

    private final byte[] sessionID;

    public Session(byte[] sessionID) {
        this.sessionID = sessionID;
    }

    public byte[] getSessionID() {
        return sessionID;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Session session = (Session) o;

        if (!Arrays.equals(sessionID, session.sessionID)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return sessionID != null ? Arrays.hashCode(sessionID) : 0;
    }
}
